package com.bsoft.gol.hcs.specialist.dao;

import ctd.persistence.annotation.DAOMethod;
import ctd.persistence.annotation.DAOParam;
import ctd.persistence.support.hibernate.HibernateSupportDelegateDAO;
import com.bsoft.gol.hcs.specialist.entity.DiseasePeriodEntity;

import java.util.List;

/**
 * 病种分期dao
 *
 * @author niule
 */
public abstract class DiseasePeriodDAO extends HibernateSupportDelegateDAO<DiseasePeriodEntity> {


    @DAOMethod(sql = " from DiseasePeriodEntity where diseaseTypeId =:diseaseTypeId order by serialNumber asc ")
    public abstract List<DiseasePeriodEntity> queryDiseasePeriodListByDiseaseTypeId(@DAOParam("diseaseTypeId")Long diseaseTypeId);

    @DAOMethod(sql = " from DiseasePeriodEntity where diseaseTypeId =:diseaseTypeId and level='1' and parentPeriodId=0 order by serialNumber asc ")
    public abstract List<DiseasePeriodEntity> queryOneLevelListByDiseaseTypeId(@DAOParam("diseaseTypeId")Long diseaseTypeId);

    @DAOMethod(sql = " from DiseasePeriodEntity where parentPeriodId =:parentPeriodId order by serialNumber asc ")
    public abstract List<DiseasePeriodEntity> querySonListByParentPeriodId(@DAOParam("parentPeriodId")Long parentPeriodId);

    @DAOMethod(sql = " delete from DiseasePeriodEntity where diseaseTypeId =:diseaseTypeId ")
    public abstract void deleteDiseasePeriodByDiseaseTypeId(@DAOParam("diseaseTypeId")Long diseaseTypeId);

    @DAOMethod(sql = " delete from DiseasePeriodEntity where periodId =:periodId) ")
    public abstract void deleteDiseasePeriodByPeriodId(@DAOParam("periodId")Long periodId);

    @DAOMethod(sql = " delete from DiseasePeriodEntity where periodId in (:periodIdList) ")
    public abstract void deleteDiseasePeriodByPeriodIds(@DAOParam("periodIdList")List<Long> periodIdList);

    @DAOMethod(sql = " select periodId from DiseasePeriodEntity where diseaseTypeId =:diseaseTypeId ")
    public abstract List<Long> queryPeriod(@DAOParam("diseaseTypeId") Long diseaseTypeId);
}
